{% extends "base.html" %}

{% block js %}
<script src="{{ MEDIA_URL }}js/search.js"></script>
<script>
$(document).ready(function() {
  search_setcb('student', function (student) {
    window.location.href = '{% url student %}' + student.pk + '/';
  });
  
  {% if student %}
  $('#enrollment_sheet_selector').change(function(e) {
    window.location.href = '{% url student student.pk %}' + $(e.target).val() + '/';
  });
  {% endif %}

{% if not student %}
  search_show('student');
{% endif %}
})
</script>
{% endblock %}

{% block content %}
<button onclick="search_show('student');">Poišči študenta</button>
{% include "snippets/core/print.htm" %}
<div class="ro_form" id="student_info">
{% if student %}
  <fieldset>
    <legend>Vpisni listi</legend>
    {% if not request.printing %}
      <select style="width: 500px;" size="6" id="enrollment_sheet_selector">
                {% for an_enrollment_sheet in student.enrollment_sheets.all %}
                  <option{% if enrollment_sheet == an_enrollment_sheet %} selected{% endif %} value="{{ an_enrollment_sheet.pk }}">{{ an_enrollment_sheet.academic_year }} - {{ an_enrollment_sheet.student_year }}. letnik - {% if an_enrollment_sheet.full_time_student %}Redni{% else %}Izredni{% endif %} - {{ an_enrollment_sheet.get_enrollment_type_display }}</option>
                {% endfor %}
                </select>
    {% else %}
      {% for an_enrollment_sheet in student.enrollment_sheets.all %}
        {{ an_enrollment_sheet.academic_year }} - {{ an_enrollment_sheet.student_year }}. letnik - {% if an_enrollment_sheet.full_time_student %}Redni{% else %}Izredni{% endif %} - {{ an_enrollment_sheet.get_enrollment_type_display }}<br />
      {% endfor %}
    {% endif %}
  </fieldset>
  <fieldset>
    <legend>Osnovni podatki o študentu</legend>
    <p>
      <label>Slika</label> <img src="{% if enrollment_sheet.image %}{{ enrollment_sheet.image.url }}{% else %}{{ MEDIA_URL }}img/user-icon.jpg{% endif %}" />
    </p>
    <p>
      <label>Ime in priimek</label> {{ enrollment_sheet.student.user.first_name }}&nbsp;{{ enrollment_sheet.student.user.last_name }}
    </p>
    {% if enrollment_sheet.student.maiden_name %}
    <p>
      <label>Dekliški priimek</label> {{ enrollment_sheet.student.maiden_name }}
    </p>
    {% endif %}
    <p>
      <label>EMŠO</label> {{ enrollment_sheet.emso }}
    </p>
    <p>
      <label>Davčna številka</label> {{ enrollment_sheet.vat_number }}
    </p>
    <p>
      <label>Posebne potrebe</label> {% if enrollment_sheet.special_needs %}{{ enrollment_sheet.get_special_needs_display }}{% else %}Brez{% endif %}
    </p>
  </fieldset>
  
  <fieldset>
    <legend>Kontaktne informacije</legend>
    <p>
      <label>E-poštni naslov</label> {{ enrollment_sheet.email }}
    </p>
    <p>
      <label>Telefonska številka</label> {{ enrollment_sheet.telephone }}
    </p>
  </fieldset>
  
  <fieldset>
    <legend>Stalno prebivališče</legend>
    <p>
      <label>Ulica in hišna številka</label> {{ enrollment_sheet.permanent_street }}
    </p>
    <p>
      <label>Pošta</label> {{ enrollment_sheet.permanent_postal_number }}
    </p>
    <p>
      <label>Občina</label> {{ enrollment_sheet.permanent_commune }}
    </p>
    <p>
      <label>Država</label> {{ enrollment_sheet.country }}
    </p>
  </fieldset>
  
  {% if enrollment_sheet.temporary_street %}
  <fieldset>
    <legend>Začasno prebivališče</legend>
    <p>
      <label>Ulica in hišna številka</label> {{ enrollment_sheet.temporary_street }}
    </p>
    <p>
      <label>Pošta</label> {{ enrollment_sheet.temporary_postal_number }}
    </p>
    <p>
      <label>Občina</label> {{ enrollment_sheet.temporary_commune }}
    </p>
  </fieldset>
  {% endif %}
  
  <fieldset>
    <legend>Informacije o študiju</legend>
    <p>
      <label>Visokošolski zavod</label> {{ enrollment_sheet.institution }}
    </p>
    <p>
      <label>Študijski program</label> {{ enrollment_sheet.student_program }}
    </p>
    <p>
      <label>Smer in izbirna skupina</label> {% if enrollment_sheet.student_course_group %}{{ enrollment_sheet.student_course_group }}{% else %}Brez{% endif %}
    </p>
    <p>
      <label>Skupina</label> {% if enrollment_sheet.student_group %}{{ enrollment_sheet.student_group }}{% else %}Brez{% endif %}
    </p>
    <p>
      <label>Študijsko leto</label> {{ enrollment_sheet.academic_year }}
    </p>
    <p>
      <label>Vrsta študija</label> {{ enrollment_sheet.get_study_type_display }}
    </p>
    <p>
      <label>Letnik študija</label> {{ enrollment_sheet.student_year }}
    </p>
    <p>
      <label>Redni študij</label> {% if enrollment_sheet.full_time_student %}Da{% else %}Ne{% endif %}
    </p>
    <p>
      <label>Vrsta vpisa</label> {{ enrollment_sheet.get_enrollment_type_display }}
    </p>
  </fieldset>
  
  <fieldset>
    <legend>Dodatne informacije o študiju</legend>
    <p>
      <label>Študij na daljavo</label> {% if enrollment_sheet.distance_education %}Da{% else %}Ne{% endif %}
    </p>
    {% if studying_location %}
    <p>
      <label>Kraj izvajanja študija</label> {{ enrollment_sheet.studying_location }}
    </p>
    {% endif %}
    {% if enrollment_sheet.additional_studying_insitution %}
    <p>
      <legend>Izobražuje se tudi na izobraževalnem zavodu</legend> {{ enrollment_sheet.additional_studying_insitution }}
    </p>
    {% endif %}
  </fieldset>
{% endif %}
</div>
{% endblock %}
